﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using CottagesOfHope.Core.Models;
using CottagesOfHope.Core.Concrete;
using CottagesOfHope.Core.Abstract;


namespace CottagesOfHope.Controllers
{
    public class EventController : Controller
    {
        private readonly ICottagesOfHopeRepository _cottagesOfHopeRepository;

        public EventController(ICottagesOfHopeRepository cottagesOfHopeRepository)
        {
            _cottagesOfHopeRepository = cottagesOfHopeRepository;
        }

        // GET: /Event/
        public ActionResult Index()
        {
            return View(_cottagesOfHopeRepository.Users); 
        }

        public ActionResult Create()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Create(Events e)
        {
            if (ModelState.IsValid)
            {
                _cottagesOfHopeRepository.SaveEvent(e);
                return RedirectToAction("Index");
            }

            return View(e);
        }
    }
}
